package com.perfma.xtest.byd;

import java.io.*;

/**
 *
 *
 * @author: junhui.si
 * @date: 2024-06-07 10:24
 **/
public class JsonReplace {
    public static void main(String[] args) {
        String inputFile = "/Users/sijunhui/Downloads/log/ESdata.txt"; // 输入文件路径
        String outputFile = "/Users/sijunhui/Downloads/log/ESdata2.txt"; // 输出文件路径

        filterFile(inputFile, outputFile);
    }

    private static void filterFile(String inputFile, String outputFile) {
        try (BufferedReader reader = new BufferedReader(new FileReader(inputFile));
             BufferedWriter writer = new BufferedWriter(new FileWriter(outputFile))) {

            String line;
            while ((line = reader.readLine()) != null) {
                // 检查是否包含特定字符串
                if (!line.contains("diskIoTimeProportion") && !line.contains("diskWriteSpendTime")
                        && !line.contains("disks")) {
                    writer.write(line);
                    writer.newLine();
                }
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
